import 'package:backend.core/core/domain/entities/google_play/google_play_purchased_subscription_transaction_offer_type.dart';
import 'package:backend.core/core/domain/entities/google_play/google_play_transaction.dart';
import 'package:backend.core/core/domain/entities/google_play/google_play_transaction_revocation_info.dart';
import 'package:equatable/equatable.dart';

class GooglePlayPurchasedSubscriptionTransaction extends Equatable
    implements GooglePlayTransaction {
  const GooglePlayPurchasedSubscriptionTransaction({
    required this.orderId,
    required this.googlePlayUserId,
    required this.purchaseToken,
    required this.purchaseItemSku,
    required this.test,
    required this.time,
    required this.revocationInfo,
    required this.expirationTime,
    required this.offerType,
  });

  @override
  final String orderId;

  @override
  final String googlePlayUserId;

  @override
  final String purchaseToken;

  @override
  final String purchaseItemSku;

  @override
  final bool test;

  @override
  final DateTime time;

  @override
  final GooglePlayTransactionRevocationInfo? revocationInfo;

  final DateTime expirationTime;
  final GooglePlayPurchasedSubscriptionTransactionOfferType offerType;

  @override
  List<Object?> get props {
    return [
      orderId,
      googlePlayUserId,
      purchaseToken,
      purchaseItemSku,
      test,
      time,
      revocationInfo,
      expirationTime,
      offerType,
    ];
  }

  GooglePlayPurchasedSubscriptionTransaction copyWith({
    String Function()? orderId,
    String Function()? googlePlayUserId,
    String Function()? purchaseToken,
    String Function()? purchaseItemSku,
    bool Function()? test,
    DateTime Function()? time,
    GooglePlayTransactionRevocationInfo? Function()? revocationInfo,
    DateTime Function()? expirationTime,
    GooglePlayPurchasedSubscriptionTransactionOfferType Function()? offerType,
  }) {
    return GooglePlayPurchasedSubscriptionTransaction(
      orderId: orderId == null ? this.orderId : orderId(),
      googlePlayUserId: googlePlayUserId == null ? this.googlePlayUserId : googlePlayUserId(),
      purchaseToken: purchaseToken == null ? this.purchaseToken : purchaseToken(),
      purchaseItemSku: purchaseItemSku == null ? this.purchaseItemSku : purchaseItemSku(),
      test: test == null ? this.test : test(),
      time: time == null ? this.time : time(),
      revocationInfo: revocationInfo == null ? this.revocationInfo : revocationInfo(),
      expirationTime: expirationTime == null ? this.expirationTime : expirationTime(),
      offerType: offerType == null ? this.offerType : offerType(),
    );
  }
}
